
   public class ComplexTest extends TestCase { 
   Complex a = new Complex(2, 1); 
   Complex b = new Complex(1,2); 
   Complex c = new Complex(); 
   @Test 
   public void testAdd() { 
   c = a.ComplexAdd(b); 
   assertEquals("3.0+3.0i", c.toString()); 
   } 
   @Test 
   public void testSub() { 
   c = a.ComplexSub(b); 
   assertEquals("1.0-1.0i", c.toString()); 
   } 
   @Test 
   public void testMulti() { 
   c = a.ComplexMulti(b); 
   assertEquals("4.0", c.toString()); 
   } 
   @Test 
   public void testDiv() { 
   c = a.ComplexDiv(c); 
   assertEquals("2.0+1.0i", c.toString()); 
   c = a.ComplexDiv(b); 
   assertEquals("2.0+0.5i", c.toString()); 
   } 
  } 
